package com.axonactive.yolo.webservice;

import java.io.IOException;

import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.MultivaluedMap;

import com.axonactive.yolo.webservice.utils.Utils;

@Path("/airline_list")
public class Airline {


	/**
	 * @param paramReceived
	 * KEY: airlineListParam
	 * VALUE: {"timeStamp":"123456789"}
	 * @return jsonObj
	 * @throws IOException
	 * @throws InterruptedException
	 */
	@POST
	@Path("/get")
	@Consumes(MediaType.APPLICATION_FORM_URLENCODED)
	@Produces(MediaType.APPLICATION_JSON)
	public String getAirlines(
			MultivaluedMap<String, String> paramReceived)
			throws IOException, InterruptedException {
//		String param = Utils.encode(paramReceived.getFirst("airlineListParam"));
		return Utils.call("get_airlines_list/" + paramReceived.getFirst("airlineListParam"));
	}
	
	@GET
	@Path("/test")
	@Produces(MediaType.APPLICATION_JSON)
	public String testAirline(){
		return "get airline demo";
	}
}
